<?xml version="1.0"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head><title>SASAPI</title><script src="../../../quicknav.js" type="text/javascript"></script><script><!--
document.quicknavBasePath="../../../index-files";
//--></script><link href="../../../style.css" title="JavaDoc" rel="stylesheet" type="text/css"/><link href="../../../unnatural.css" title="Unnatural" rel="alternate stylesheet" type="text/css"/><link href="../../../overview-summary.html" title="Overview" rel="top"/><meta name="generator" content="http://www.badgers-in-foil.co.uk/projects/as2api/"/></head><body><pre><span class="lineno" id="1">     1  </span><span class="comment doc">/**
<span class="lineno" id="2">     2  </span> * com.sekati.events.Event
<span class="lineno" id="3">     3  </span> * @version 1.1.5
<span class="lineno" id="4">     4  </span> * @author jason m horwitz | sekati.com
<span class="lineno" id="5">     5  </span> * Copyright (C) 2007  jason m horwitz, Sekat LLC. All Rights Reserved.
<span class="lineno" id="6">     6  </span> * Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
<span class="lineno" id="7">     7  </span> */</span>
<span class="lineno" id="8">     8  </span>
<span class="lineno" id="9">     9  </span><span class="key">import</span> com.sekati.core.CoreObject;
<span class="lineno" id="10">    10  </span><span class="key">import</span> com.sekati.events.IEvent;
<span class="lineno" id="11">    11  </span><span class="lineno" id="12">    12  </span><span class="comment doc">/**
<span class="lineno" id="13">    13  </span> * SASAPI Base Event class, works similarly to the AS3 Event class&lt;br&gt;&lt;br&gt;
<span class="lineno" id="14">    14  </span> * 
<span class="lineno" id="15">    15  </span> * The {@link com.sekati.events.Dispatcher} class excepts an object with at least one property: 'type:String'
<span class="lineno" id="16">    16  </span> * which is the identifier of the event. This is either the listener's function that is called when the event
<span class="lineno" id="17">    17  </span> * is dispatched, or the link through Delegate to the function to be called. Other optional properties 
<span class="lineno" id="18">    18  </span> * are:'target:Object', which is the source of the event &amp; 'data:Object', which may contain any information 
<span class="lineno" id="19">    19  </span> * you wish to pass along with the event.
<span class="lineno" id="20">    20  </span> */</span>
<span class="lineno" id="21">    21  </span><span class="key">class</span> com.sekati.events.Event <span class="key">extends</span> CoreObject <span class="key">implements</span> IEvent {
<span class="lineno" id="22">    22  </span><span class="lineno" id="23">    23  </span>	<span class="key">private</span> <span class="key">var</span> _type:String;
<span class="lineno" id="24">    24  </span>	<span class="key">private</span> <span class="key">var</span> _target:Object;
<span class="lineno" id="25">    25  </span>	<span class="key">private</span> <span class="key">var</span> _data:Object;
<span class="lineno" id="26">    26  </span>	<span class="key">private</span> <span class="key">var</span> _route:Array;
<span class="lineno" id="27">    27  </span><span class="lineno" id="28">    28  </span>	<span class="comment doc">/**
<span class="lineno" id="29">    29  </span>	 * Constructor creates an event object fit for dispatching
<span class="lineno" id="30">    30  </span>	 * Note: the contents of the data parameter are copied to
<span class="lineno" id="31">    31  </span>	 * the Event object for legacy support.
<span class="lineno" id="32">    32  </span>	 * @param type (String) type of event
<span class="lineno" id="33">    33  </span>	 * @param target (Object) the object that dispatched this event.
<span class="lineno" id="34">    34  </span>	 * @param data (Object) optional data to pass with the event
<span class="lineno" id="35">    35  </span>	 * @return Void
<span class="lineno" id="36">    36  </span>	 */</span>
<span class="lineno" id="37">    37  </span>	<span class="key">public</span> <span class="key">function</span> Event(type:String, target:Object, data:Object) {
<span class="lineno" id="38">    38  </span>		_type = type;
<span class="lineno" id="39">    39  </span>		_target = target;
<span class="lineno" id="40">    40  </span>		_data = data;
<span class="lineno" id="41">    41  </span>		<span class="comment">// clone _data properties to the Event instance</span>
<span class="lineno" id="42">    42  </span>		<span class="key">for</span> (<span class="key">var</span> i <span class="key">in</span> _data) <span class="key">this</span>[i] = _data[i];
<span class="lineno" id="43">    43  </span>		_route = <span class="key">new</span> Array( );
<span class="lineno" id="44">    44  </span>	}
<span class="lineno" id="45">    45  </span><span class="lineno" id="46">    46  </span>	<span class="key">public</span> <span class="key">function</span> get type():String {
<span class="lineno" id="47">    47  </span>		<span class="key">return</span> _type;	
<span class="lineno" id="48">    48  </span>	}
<span class="lineno" id="49">    49  </span><span class="lineno" id="50">    50  </span>	<span class="key">public</span> <span class="key">function</span> get target():Object {
<span class="lineno" id="51">    51  </span>		<span class="key">return</span> _target;
<span class="lineno" id="52">    52  </span>	}
<span class="lineno" id="53">    53  </span><span class="lineno" id="54">    54  </span>	<span class="key">public</span> <span class="key">function</span> get data():Object {
<span class="lineno" id="55">    55  </span>		<span class="key">return</span> _data;	
<span class="lineno" id="56">    56  </span>	}
<span class="lineno" id="57">    57  </span><span class="lineno" id="58">    58  </span>	<span class="key">public</span> <span class="key">function</span> bubble(newTarget:Object):Void {
<span class="lineno" id="59">    59  </span>		_route.push( _target );
<span class="lineno" id="60">    60  </span>		_target = newTarget;
<span class="lineno" id="61">    61  </span>	}	
<span class="lineno" id="62">    62  </span>}</pre><ul class="main_nav" id="main_nav"><li><a href="../../../overview-summary.html" title="Overview of SASAPI" class="button">Overview</a></li><li><a href="package-summary.html" title="Overview of package com.sekati.events" class="button">Package</a></li><li><a href="Event.html" title="Detail of com.sekati.events.Event API" class="button">Class</a></li><li><span class="button nav_current">Source</span></li><li><a href="../../../index-files/index.html" title="Alpabetical index of types and members" class="button">Index</a></li></ul><div class="footer"><a href="http://www.badgers-in-foil.co.uk/projects/as2api/" title="ActionScript 2 API Documentation Generator">as2api</a></div></body></html>